package com.wayne.testapp.utils;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;


/**
 * Created by wayne on 2016/07/06.
 */
public class MUtils {

    /**
     * 将文件转成base64 字符串
     */

    public static String encodeBase64File(String path) throws Exception {

        File file = new File(path);
        FileInputStream inputFile = new FileInputStream(file);
        byte[] buffer = new byte[(int) file.length()];
        inputFile.read(buffer);
        inputFile.close();
//        return new android.util.Base64;
        return android.util.Base64.encodeToString(buffer, Base64.DEFAULT);

    }
}
